<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>nth-child</title>
  <style>
    p:nth-of-type(2) {
      background: #ff0000;
    }
  </style>
</head>

<body>
  <h1>这是标题</h1>
  <div>
    <p>第n个段落。</p>
    <span>第n个段落。</span>
    <p>=-----</p>
  </div>
  <p>第一个段落。</p>
  <p>第二个段落。</p>
  <p>第三个段落。</p>
  <p>第四个段落。</p>
  <p>第五个段落。</p>
  <p>第六个段落。</p>
</body>

</html>